//导入Vue
import Vue from 'vue'

//导入路由包
import Router from 'vue-router'

//导入组件
import login from '@/components/login.vue'
import main from '@/components/main.vue'
import viewInfo from '@/components/personalInfo/viewInfo.vue'
import userInfo from '@/components/user/viewUser.vue'

//导入公告信息管理组件
import noticeInfo from '@/components/notice/noticeInfo'
//导入学生信息管理组件
import studentInfo from '@/components/student/studentInfo'
//导入宿管信息管理组件
import managerInfo from '@/components/manager/managerInfo'
//导入宿管信息管理组件
import roomInfo from '@/components/room/roomInfo'
//导入宿管信息管理组件
import storeyInfo from '@/components/storey/storeyInfo'
//导入宿舍电费管理组件
import electricInfo from '@/components/electric/electricInfo'
//导入宿舍水费管理组件
import waterInfo from '@/components/water/waterInfo'
//导入失物招领管理组件
import lostInfo from '@/components/lost/lostInfo'
//导入失物招领管理组件
import repairInfo from '@/components/repair/repairInfo'





//使用路由
Vue.use(Router)

const routes =[
  { path: '/', component: login, meta:{title:'登录'}},

  
  //首页
  {
    path: '/main',
    component: main,
    children: [
      {
        //为空即为 el-main中 默认显示的组件
        path: '',
        component: ()=>import('@/components/main/right.vue'),
        meta:{
          title:'首页'
        }
      },

    ],

  },


    //个人资料管理
  {
    path: '/viewInfo',
    component: main,
    children: [
      {
        path: '',
        component: viewInfo,
        meta:{
          title:'个人资料管理'
        }
      },

    ]
  },


  //用户信息管理
  {
    path: '/userInfo',
    component: main,
    children: [
      {

        path: '',
        component: userInfo,
        meta:{
          title:'用户信息管理'
        }
      },

    ]
  },

    //-------------------------------------------------------------------------------------
   //公告信息管理
   {
    path: '/noticeInfo',
    component: main,
    children: [
      {

        path: '',
        component: noticeInfo,
        meta:{
          title:'公告信息管理'
        }
      },

    ]
  },

   //学生信息管理
   {
    path: '/studentInfo',
    component: main,
    children: [
      {

        path: '',
        component: studentInfo,
        meta:{
          title:'学生信息管理'
        }
      },

    ]
  },

   //宿管信息管理
   {
    path: '/managerInfo',
    component: main,
    children: [
      {

        path: '',
        component: managerInfo,
        meta:{
          title:'宿管信息管理'
        }
      },

    ]
  },

   //宿舍信息管理
   {
    path: '/roomInfo',
    component: main,
    children: [
      {

        path: '',
        component: roomInfo,
        meta:{
          title:'宿舍信息管理'
        }
      },

    ]
  },

   //楼栋信息管理
   {
    path: '/storeyInfo',
    component: main,
    children: [
      {

        path: '',
        component: storeyInfo,
        meta:{
          title:'楼栋信息管理'
        }
      },

    ]
  },

   //宿舍电费管理
   {
    path: '/electricInfo',
    component: main,
    children: [
      {

        path: '',
        component: electricInfo,
        meta:{
          title:'宿舍电费管理'
        }
      },

    ]
  },

   //宿舍水费管理
   {
    path: '/waterInfo',
    component: main,
    children: [
      {

        path: '',
        component: waterInfo,
        meta:{
          title:'宿舍水费管理'
        }
      },

    ]
  },

   //失物招领管理
   {
    path: '/lostInfo',
    component: main,
    children: [
      {
        path: '',
        component: lostInfo,
        meta:{
          title:'失物招领管理'
        }
      },

    ]
  },

   //宿舍报修管理
   {
    path: '/repairInfo',
    component: main,
    children: [
      {

        path: '',
        component: repairInfo,
        meta:{
          title:'宿舍保修管理'
        }

      },

    ]
  },
]

const router = new Router({
  routes
})

router.afterEach((to, from) => {
  // to and from are both route objects.
  document.title = to.meta.title
})

export default router
